package 并查集;

public class QuickUnionRankPS extends QuickUnionRank{

	public QuickUnionRankPS(int capacity) {
		super(capacity);
	}
	
	/**
	 * 路径分裂
	 */
	@Override
	public int find(int v) {
		rangeCheck(v);
		while (v != parents[v]) {
			int p = parents[v];
			parents[v] = parents[parents[v]];
			v = p;
		}
		return v;
	}
	
}
